/*
 * broadcast.h
 *
 *  Created on: 23 oct. 2013
 *      Author: praaa
 */

#ifndef BROADCAST_H_
#define BROADCAST_H_

#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>


int sendline(int fd, const void *str, int maxlen);
int readline(int fd, void *str, int maxlen);


typedef struct s_client * t_client;
typedef struct s_client   s_client;

void set_socket(int socket, t_client client );
int get_number_socket(t_client client);
void set_name(char* name,  t_client client);
char* get_name( t_client client);


typedef struct client_list * client_list;


t_client client_from_end_list(client_list list);
t_client client_from_head_list(client_list list);
t_client find_client(client_list list, int socket);
void list_display(client_list list,int fd);

extern client_list new_list();
extern void add_elt(client_list list, void *, void (*ptrfreefunction)(void *));

void unicast(int fd, char *buffer, client_list list);



void search_delete(char *chaine);


#endif /* BROADCAST_H_ */
